var mongoose = require('./A-mongodb')
const Schema = mongoose.Schema

let usersSchema = new Schema({
    username : String,
    password: { //密码
        type: String,
        default: "123456"
    },
    openid : {
        type : String,
        default : ''
    },
    head: { //头像
        type: String,
        default: 'upload/header.jpg'
    },
    gender:{//性别
        type:String,
        default : ""
    } , 
    birthday : {
        type : Date,
        default : new Date()
    },
    mobile:{//电话
        type:String,
        default : ""
    } , 
    road: {//地区
        type:String,
        default : ""
    } , 
    key: {
        type: String,
        default: Date.parse(new Date()) / 1000,
    }, //
    state: { //账号状态
        type: Boolean,
        default: true
    }
    

})

let bandsSchema = new Schema({
    bandId:{
        type : String,
        default : ""
    },
    Bind_bank_card :{
        type : Boolean,
        default : false
    },
    u_id : {
        type : mongoose.Types.ObjectId,
        ref :'users'
    }
})

const userModel = mongoose.model("users",usersSchema)
const bandsSModel = mongoose.model("bands",bandsSchema)

module.exports = { userModel,bandsSModel }